/**
 * @file	DataProcessing.cpp
 * @author	Ben Treweek <btreweek@gmail.com>
 * @version 0.0.1
 * @date	06/02/2011	
 *
 * @section License
 * This program is propety of Jyeah Jyeah Jyeah Jyeah Jyeah and may not be used 
 * by any individual for any purpose at any time without express permission from 
 * Mike Casey, Thomas Fu, Chris Hairfield, Kyle Lamson, Ben Treweek, or Cliff 
 * Warren.
 *
 * @brief 
 * This file contains the implementation of data processing methods to be used  
 * for input and output data being passed to and from a neural network. 
 */

#include "DataProcessing.h"

/*
 * Function that scales a two dimensional array of either floats or doubles
 * such that all of the values in each column are between SCALE_MIN and 
 * SCALE_MAX. This is achieved column-by-column by subtracting the minimum value
 * in each column from every value in that column, multilpying each value in 
 * that column by the multiplicative inverse of the largest value in that 
 * column, and finally by adding SCALE_MIN to each value in that column.
 */
template <typename numType>
void NormalizeDataCols(numType **rawData, numType **normalizedData, 
											 numType *offsets, numType *scaleFactors, int numRows, 
											 int numCols)
{
	return;
}

/*
 * Function that scales a two dimensional array of either floats or doubles
 * such that all of the values in each row are between SCALE_MIN and 
 * SCALE_MAX. This is achieved row-by-row by subtracting the minimum value
 * in each row from every value in that row, multilpying each value in 
 * that row by the multiplicative inverse of the largest value in that 
 * row, and finally by adding SCALE_MIN to each value in that row.
 */
template <typename numType>
void NormalizeDataRows(numType **rawData, numType **normalizedData, 
											 numType *offsets, numType *scaleFactors, int numRows, 
											 int numCols)
{
	return;
}

/*
 * Function that unscales a two normalized dimensional array of either floats or 
 * doubles, where all of the values in each column are between SCALE_MIN and 
 * SCALE_MAX, by inverting the process performed in NormalizeDataCols. 
 */
template <typename numType>
void UnNormalizeDataCols(numType **normalizedData, numType **unNormalizedData, 
												 numType *offsets, numType *scaleFactors, int numRows, 
												 int numCols)
{
	return;
}

/*
 * Function that unscales a two normalized dimensional array of either floats or 
 * doubles, where all of the values in each row are between SCALE_MIN and 
 * SCALE_MAX, by inverting the process performed in NormalizeDataRows. 
 */
template <typename numType>
void UnNormalizeDataRows(numType **normalizedData, numType **unNormalizedData, 
												 numType *offsets, numType *scaleFactors, int numRows, 
												 int numCols)
{
	return;
}

/*
 * Function that numerically computes the first derivative (up to a scaling 
 * factor) of the values contained in data and places the results in derivative. 
 * The derivative computations are O(h) or O(h^2) for speed and assume evenly 
 * spaced gridpoints. 
 */
template <typename numType>
void ComputeFirstDerivative(numType *data, numType *derivative, int numElem)
{
	return;
}

/*
 * Function that numerically computes the second derivative (up to a scaling 
 * factor) of the values contained in data and places the results in derivative. 
 * The derivative computations are O(h) or  O(h^2) for speed and assume evenly 
 * spaced gridpoints. Calculated by a different method than just two successive
 * calculations of first derivatives in order to improve speed and accuracy.
 */
template <typename numType>
void ComputeSecondDerivative(numType *data, numType *derivative, int numElem)
{
	return;
}

/*
 * Function that returns an array of integers corresponding to the indicies of 
 * the largest numToFind elements of the row of data specified by searchRow. The
 * elements of the returned array of ints should be in sorted order such that
 * the first element is the index of the largest element. If searchRow is out of 
 * bounds, this function will return NULL. If numToFind is greater than or
 * equal to the number of columns of data the returned array simply contains
 * the indices of all elements from largest to smallest.
 */
template <typename numType>
int* FindLargestMembersInRow(numType **data, int searchRow, int numToFind,
															int numRows, int numCols)
{
	return NULL;
}

/*
 * Function that returns an array of integers corresponding to the indicies of 
 * the smallest numToFind elements of the row of data specified by searchRow. 
 * The elements of the returned array of ints should be in sorted order such 
 * that the first element is the index of the smallest element. If searchRow is  
 * out of bounds, this function will return NULL. If numToFind is greater than 
 * or equal to the number of columns of data the returned array simply contains
 * the indices of all elements from smallest to largest.
 */
template <typename numType>
int* FindSmallestMembersInRow(numType **data, int searchRow, int numToFind,
															 int numRows, int numCols)
{
	return NULL;
}

/*
 * Function that returns an array of integers corresponding to the indicies of 
 * the largest numToFind elements of the column of data specified by searchCol. 
 * The elements of the returned array of ints should be in sorted order such 
 * that the first element is the index of the largest element. If searchCol is
 * out of bounds, this function will return NULL. If numToFind is greater than 
 * or equal to the number of rows of data the returned array simply contains
 * the indices of all elements from largest to smallest.
 */
template <typename numType>
int* FindLargestMembersInCol(numType **data, int searchCol, int numToFind,
															int numRows, int numCols)
{
	return NULL;
}

/*
 * Function that returns an array of integers corresponding to the indicies of 
 * the smallest numToFind elements of the column of data specified by searchCol. 
 * The elements of the returned array of ints should be in sorted order such 
 * that the first element is the index of the smallest element. If searchCol is
 * out of bounds, this function will return NULL. If numToFind is greater than 
 * or equal to the number of rows of data the returned array simply contains
 * the indices of all elements from smallest to largest.
 */
template <typename numType>
int* FindSmallestMembersInCol(numType **data, int searchCol, int numToFind,
															 int numRows, int numCols)
{
	return NULL;
}


